package com.dbexposer.db.info;

public class Table {

	private org.apache.ddlutils.model.Table delegate;

	Table(org.apache.ddlutils.model.Table table) {
		this.delegate = table;
	}

	public Column[] getAutoIncrementColumns() {
		return wrapColumns(delegate.getAutoIncrementColumns());
	}

	public String getCatalog() {
		return delegate.getCatalog();
	}

	public Column getColumn(int idx) {
		return new Column(delegate.getColumn(idx));
	}

	public int getColumnCount() {
		return delegate.getColumnCount();
	}

	public int getColumnIndex(Column column) {
		return delegate.getColumnIndex(column.getDelegate());
	}

	public Column[] getColumns() {
		return wrapColumns(delegate.getColumns());
	}

	public String getDescription() {
		return delegate.getDescription();
	}

	public int getForeignKeyCount() {
		return delegate.getForeignKeyCount();
	}

	public int getIndexCount() {
		return delegate.getIndexCount();
	}

	public String getName() {
		return delegate.getName();
	}

	public Column[] getPrimaryKeyColumns() {
		org.apache.ddlutils.model.Column[] primaryKeyColumns = delegate.getPrimaryKeyColumns();
		return wrapColumns(primaryKeyColumns);
	}

	public String getSchema() {
		return delegate.getSchema();
	}

	public String getType() {
		return delegate.getType();
	}

	private Column[] wrapColumns(org.apache.ddlutils.model.Column[] columns) {

		Column[] wrapped = new Column[columns.length];

		for (int i = 0; i < wrapped.length; i++) {
			wrapped[i] = new Column(columns[i]);
		}

		return wrapped;
	}
	
	public String toString() {
		return delegate.toString();
	}

	public String toVerboseString() {
		return delegate.toVerboseString();
	}
}
